package cn.xuqiudong.rpc.protocol.netty;

import cn.xuqiudong.rpc.protocol.netty.model.XqdFuture;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;

/**
 * 描述:本地线程持有容器
 * @author Vic.xu
 * @date 2022-02-22 13:10
 */
public class RequestHolder {

    public static final AtomicLong REQUEST_ID=new AtomicLong();

    public static final Map<Long, XqdFuture> REQUEST_MAP=new ConcurrentHashMap<>();

    /**
     * 基于AtomicLong获取线程的标识
     * @return
     */
    public static long getRequestId(){
        return REQUEST_ID.getAndIncrement();
    }

}
